package com.ruoyi.shop.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shop.mapper.ShopProductImageMapper;
import com.ruoyi.shop.domain.ShopProductImage;
import com.ruoyi.shop.service.IShopProductImageService;
import com.ruoyi.common.core.text.Convert;

/**
 * 商品图片Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2021-09-12
 */
@Service
public class ShopProductImageServiceImpl implements IShopProductImageService 
{
    @Autowired
    private ShopProductImageMapper shopProductImageMapper;

    /**
     * 查询商品图片
     * 
     * @param id 商品图片主键
     * @return 商品图片
     */
    @Override
    public ShopProductImage selectShopProductImageById(Long id)
    {
        return shopProductImageMapper.selectShopProductImageById(id);
    }

    /**
     * 查询商品图片列表
     * 
     * @param shopProductImage 商品图片
     * @return 商品图片
     */
    @Override
    public List<ShopProductImage> selectShopProductImageList(ShopProductImage shopProductImage)
    {
        return shopProductImageMapper.selectShopProductImageList(shopProductImage);
    }

    /**
     * 新增商品图片
     * 
     * @param shopProductImage 商品图片
     * @return 结果
     */
    @Override
    public int insertShopProductImage(ShopProductImage shopProductImage)
    {
        shopProductImage.setCreateTime(DateUtils.getNowDate());
        return shopProductImageMapper.insertShopProductImage(shopProductImage);
    }

    /**
     * 修改商品图片
     * 
     * @param shopProductImage 商品图片
     * @return 结果
     */
    @Override
    public int updateShopProductImage(ShopProductImage shopProductImage)
    {
        return shopProductImageMapper.updateShopProductImage(shopProductImage);
    }

    /**
     * 批量删除商品图片
     * 
     * @param ids 需要删除的商品图片主键
     * @return 结果
     */
    @Override
    public int deleteShopProductImageByIds(String ids)
    {
        return shopProductImageMapper.deleteShopProductImageByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除商品图片信息
     * 
     * @param id 商品图片主键
     * @return 结果
     */
    @Override
    public int deleteShopProductImageById(Long id)
    {
        return shopProductImageMapper.deleteShopProductImageById(id);
    }
}
